package com.ycg.store.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;

import jakarta.validation.constraints.NotBlank;
import lombok.Data;

/**
 * 货品表
 * @TableName good
 */
@TableName(value ="good")
@Data
public class Good implements Serializable {
    /**
     * id
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 租户id
     */
    @NotBlank(message = "租户id不为空")
    private Integer tenantId;

    /**
     * 货品编号
     */
    @NotBlank(message = "货品编号不为空")
    private String number;

    /**
     * 货品名称
     */
    @NotBlank(message = "货品名称不为空")
    private String name;

    /**
     * 货品类型:成品,半成品,原材料
     */
    private String type;

    /**
     * 来源: 外购,自制
     */
    private String origin;

    /**
     * 计量单位
     */
    private String unit;

    /**
     * 参考成本(成品)
     */
    private Integer cost;

    /**
     * 参考售价(成品)
     */
    private Integer price;

    /**
     * 进项税额
     */
    private Integer inTax;

    /**
     * 销项税额
     */
    private Integer outTax;

    /**
     * 重量
     */
    private Integer weight;

    /**
     * 重量单位
     */
    private String weightUnit;

    /**
     * 备注
     */
    private String comment;

    /**
     * 创建日期 
     */
    private LocalDateTime createTime;

    /**
     * 更新日期 
     */
    private LocalDateTime updateTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Good other = (Good) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getTenantId() == null ? other.getTenantId() == null : this.getTenantId().equals(other.getTenantId()))
            && (this.getNumber() == null ? other.getNumber() == null : this.getNumber().equals(other.getNumber()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getOrigin() == null ? other.getOrigin() == null : this.getOrigin().equals(other.getOrigin()))
            && (this.getUnit() == null ? other.getUnit() == null : this.getUnit().equals(other.getUnit()))
            && (this.getCost() == null ? other.getCost() == null : this.getCost().equals(other.getCost()))
            && (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
            && (this.getInTax() == null ? other.getInTax() == null : this.getInTax().equals(other.getInTax()))
            && (this.getOutTax() == null ? other.getOutTax() == null : this.getOutTax().equals(other.getOutTax()))
            && (this.getWeight() == null ? other.getWeight() == null : this.getWeight().equals(other.getWeight()))
            && (this.getWeightUnit() == null ? other.getWeightUnit() == null : this.getWeightUnit().equals(other.getWeightUnit()))
            && (this.getComment() == null ? other.getComment() == null : this.getComment().equals(other.getComment()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getTenantId() == null) ? 0 : getTenantId().hashCode());
        result = prime * result + ((getNumber() == null) ? 0 : getNumber().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getOrigin() == null) ? 0 : getOrigin().hashCode());
        result = prime * result + ((getUnit() == null) ? 0 : getUnit().hashCode());
        result = prime * result + ((getCost() == null) ? 0 : getCost().hashCode());
        result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
        result = prime * result + ((getInTax() == null) ? 0 : getInTax().hashCode());
        result = prime * result + ((getOutTax() == null) ? 0 : getOutTax().hashCode());
        result = prime * result + ((getWeight() == null) ? 0 : getWeight().hashCode());
        result = prime * result + ((getWeightUnit() == null) ? 0 : getWeightUnit().hashCode());
        result = prime * result + ((getComment() == null) ? 0 : getComment().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", tenantId=").append(tenantId);
        sb.append(", number=").append(number);
        sb.append(", name=").append(name);
        sb.append(", type=").append(type);
        sb.append(", origin=").append(origin);
        sb.append(", unit=").append(unit);
        sb.append(", cost=").append(cost);
        sb.append(", price=").append(price);
        sb.append(", inTax=").append(inTax);
        sb.append(", outTax=").append(outTax);
        sb.append(", weight=").append(weight);
        sb.append(", weightUnit=").append(weightUnit);
        sb.append(", comment=").append(comment);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}